﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;
using Newtonsoft.Json;

namespace CMCCMicroBlog.ViewModels
{
    public class FeedModel : INotifyPropertyChanged
    {
        [JsonProperty("id")]
        public string Id { get; set; }

        [JsonProperty("user_id")]
        public string UserId { get; set; }

        [JsonProperty("nickname")]
        public string NickName { get; set; }

        private string icon;
        [JsonProperty("icon")]
        public string Icon
        {
            get
            {
                return icon;
            }

            set
            {
                if (value.Equals(""))
                {
                    value = "http://s1.139js.com/core/img/avatar/48x48.jpg__643.jpg";
                }
                icon = value;
            }
        }

        [JsonProperty("geography")]
        public string Geography { get; set; }

        [JsonProperty("replies_count")]
        public string RepliesCount { get; set; }

        [JsonProperty("forward_count")]
        public string ForwardCount { get; set; }

        [JsonProperty("screenname")]
        public string ScreenName { get; set; }

        [JsonProperty("vtype")]
        public string Vtype { get; set; }

        [JsonProperty("vtitle")]
        public string Vtitle { get; set; }

        [JsonProperty("create_time")]
        public string CreateTime { get; set; }

        [JsonProperty("source")]
        public string Source { get; set; }

        [JsonProperty("text")]
        public string Text { get; set; }

        [JsonProperty("thumbnail_pic")]
        public string ThumbnailPic { get; set; }

        [JsonProperty("bmiddle_pic")]
        public string BmiddlePic { get; set; }

        [JsonProperty("original_pic")]
        public string OriginalPic { get; set; }

        [JsonProperty("root")]
        public FeedModel RootFeed { get; set; }


        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(String propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
